﻿namespace HySoft.Cash.BaseClass
{
    using Huayou.Common;
    using System;
    using System.Data;

    public class BasePage : CommonBasePage
    {
        private string curPageURL;
        private string m_code = "";
        private string m_Permission;
        private string m_sessionAccount;
        private string m_sessionName;
        private int m_sessionUID;
        private DataTable minPotTable;
        private DataTable potenceTable;

        private bool AllowShow()
        {
            int num = Convert.ToInt32(this.minPotTable.Rows[0][0]);
            if (num == -1)
            {
                return true;
            }
            for (int i = 0; i < this.potenceTable.Rows.Count; i++)
            {
                if (num <= Convert.ToInt32(this.potenceTable.Rows[i][1]))
                {
                    return true;
                }
            }
            return false;
        }

        protected void CheckLogin()
        {
        }

        protected void CheckPerm()
        {
            if ((this.m_code != "") && (this.m_Permission.IndexOf("," + this.m_code + ",") == -1))
            {
                base.Response.Redirect("../nopermit.aspx");
            }
        }

        private string GetCurURL()
        {
            string str = base.Request.ServerVariables["PATH_INFO"];
            int length = BaseConfManager.GetAppName().Length;
            return str.Substring(length, str.Length - length).ToUpper();
        }

        protected void GoToPage(string strPageURL)
        {
            string str = BaseConfManager.GetAppName() + strPageURL;
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.CheckLogin();
            if (this.m_sessionUID != 0)
            {
                this.CheckPerm();
            }
        }

        public string Code
        {
            get
            {
                return this.m_code;
            }
            set
            {
                this.m_code = value;
            }
        }

        public string Permission
        {
            get
            {
                return this.m_Permission;
            }
        }

        public string SessionAccount
        {
            get
            {
                return this.m_sessionAccount;
            }
        }

        public string SessionName
        {
            get
            {
                return this.m_sessionName;
            }
        }

        public int SessionUID
        {
            get
            {
                return this.m_sessionUID;
            }
        }
    }
}

